package com.wjn.basic.thread.basicthread;


/**
 * 线程：start()、sleep()、interrupt()、stop()、
 */
public class Bthread extends Thread{


    @Override
    public void run() {
        System.out.println("睡眠300000");
        try {
            Thread.sleep(300000);
        } catch (InterruptedException e) {
            System.out.println("线程interrupt停止");
        }

    }


    public static void main(String[] args) throws InterruptedException {
        Bthread bthread=new Bthread();
        bthread.start();
        Thread.sleep(3000);
        bthread.interrupt();//打标记，结束线程，常用

        Bthread bthread1=new Bthread();
        bthread1.start();
        Thread.sleep(3000);
        bthread1.stop();//强制停止，已废除

    }
}
